package com.fit.entities;

import java.util.LinkedList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.tapestry5.beaneditor.NonVisual;
import org.apache.tapestry5.beaneditor.Validate;

import com.fit.entities.manytomany.ProjSciField;
import com.fit.entities.manytomany.UserDegree;
import com.fit.entities.manytomany.UserLanguage;
import com.fit.entities.manytomany.UserOrgan;
import com.fit.entities.manytomany.UserSciField;

@Entity
@Table(name="user")
public class User {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@NonVisual
	@Column(name = "id")
	private long id;
	@Validate("required")
	@Column(name="username", unique=true, nullable=false)
	private String username;
	@Validate("required")
	@Column(name="password", nullable=false)
	private String password;
	@Validate("required")
	@Column(name = "name", nullable=false)
	private String name;
	@Validate("required")
	@Column(name = "surname", nullable=false)
	private String surname;
	@Validate("required")
	@Column(name="phone", nullable= false)
	private String phone;
	@Validate("required")
	@Column(name="fax", nullable= true)
	private String fax;
	@Validate("required")
	@Column(name="email", nullable= true)
	private String email;
	@Column(name="type", nullable= true)
	private String type;
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.user")
	private List<UserLanguage> userLanguage = new LinkedList<UserLanguage>();
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.user")
	private List<UserDegree> userDegree = new LinkedList<UserDegree>();
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.user")
	private List<UserSciField> userSciField = new LinkedList<UserSciField>();
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.user")
	private List<UserOrgan> userOrgan = new LinkedList<UserOrgan>();

	
	
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getSurname() {
		return surname;
	}
	public void setSurname(String surname) {
		this.surname = surname;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getFax() {
		return fax;
	}
	public void setFax(String fax) {
		this.fax = fax;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}	
	
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public List<UserLanguage> getUserLanguage() {
		return userLanguage;
	}
	public void setUserLanguage(List<UserLanguage> userLanguage) {
		this.userLanguage = userLanguage;
	}
	public List<UserDegree> getUserDegree() {
		return userDegree;
	}
	public void setUserDegree(List<UserDegree> userDegree) {
		this.userDegree = userDegree;
	}
	public List<UserSciField> getUserSciField() {
		return userSciField;
	}
	public void setUserSciField(List<UserSciField> userSciField) {
		this.userSciField = userSciField;
	}
	public List<UserOrgan> getUserOrgan() {
		return userOrgan;
	}
	public void setUserOrgan(List<UserOrgan> userOrgan) {
		this.userOrgan = userOrgan;
	}
	
	
	

}
